package com.mycinema.biz.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.mycinema.biz.CategoryBiz;
import com.mycinema.biz.MovieBiz;
import com.mycinema.dao.MovieDao;
import com.mycinema.entity.Movie;

@Service("movieBiz")
@Scope("prototype")
// ������
@Transactional(propagation = Propagation.REQUIRED)
// �������еķ����Զ���������
public class MovieBizImpl implements MovieBiz{
	@Autowired
	// ����ע��
	private  MovieDao movieDao;
	
	@Transactional(readOnly = true)
	// ����������,�������ϵ�ע��
	public List<Movie> getMoviePage(int cid, String title, int startIndex,
			int pageSize) {
		// TODO Auto-generated method stub
		return movieDao.getMoviePage(cid, title, startIndex, pageSize);
	}
	@Transactional(readOnly = true)
	public int getRowsCount(int cid, String title) {
		// TODO Auto-generated method stub
		return movieDao.getRowsCount(cid, title);
	}
	public Movie getById(int id) {
		// TODO Auto-generated method stub
		return movieDao.getById(id);
	}

	public void updateMovie(Movie movie) {
		// TODO Auto-generated method stub
		movieDao.updateMovie(movie);
		
	}
	public static void main(String[] args) {
		// ���������ļ�
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
				"beans.xml");
		MovieBiz movieBiz = (MovieBiz) applicationContext
				.getBean("movieBiz");
		System.out.println(movieBiz.getRowsCount(1, "accp"));
		System.out.println("ok");
	}
	public List<Movie> getMoviesWithIf(int cid, String title) {
		// TODO Auto-generated method stub
		return movieDao.getMoviesWithIf(cid, title);
	}

}
